<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>魏远商城</title>
		<meta name="viewport" content="initial-scale=1, maximum-scale=1">
		<link rel="shortcut icon" href="/favicon.ico">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="css/my-order.css" />
		<link rel="stylesheet" href="css/style.css" />
		<style>
			html,
			body {
				background: white;
			}
			
			.home-dan>p:nth-child(2) {
				font-size: .8rem!important;
				/*height: 1.5rem!important;*/
				margin-top: .5rem!important;
			}
			
			.home-dan>p:nth-child(3) {
				height: 1.5rem!important;
			}
			
			.home-picd {
				width: 100%;
				height: 5rem;
				background-position: center!important;
				background-repeat: no-repeat!important;
				background-size: cover!important;
			}
			
			.contentall {
				margin-top: 10px;
				background: white;
			}
		</style>
	</head>

	<body style="background: #eaeef1;">
		<header class="bar bar-nav return-header" style="width: 100%;">
			<span class="order-back mui-action-back"><img src="img/back-le.png" height="50%"/></span>
			<h1 class="title"></h1>
		</header>

		<div class="marketing-content">
			<div class="contentall">
				<div class="home-se"></div>
				<!--<div class="hone-recommend" style="margin-bottom: 0;">
							<p style="text-align: center;">—— 品牌推荐 ——</p>
							<p>查看更多</p>
							<img src="img/product2.png" alt="" width="96%"/>
							<div class="home-se"></div>
						</div>
						
						<div class="hone-recommend" style="margin-bottom: 0;">
							<p style="text-align: center;">—— <span class="home-sw-t">你好</span> ——</p>
							<p>查看更多</p>
							<img src="img/product2.png" alt="" width="96%"/>
							<div class="home-sw"></div>
						</div>
						
						<div class="hone-recommend" style="margin-bottom: 0;">
							<p style="text-align: center;">—— <span class="home-sq-t">你好</span> ——</p>
							<p>查看更多</p>
							<div class="home-sq"></div>
					    </div>-->
			</div>

		</div>

		<script src="js/mui.min.js"></script>
		<script src="js/jquery-3.1.1.min.js"></script>
		<script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
		<script type="text/javascript" src="js/url.js"></script>
		<script type="text/javascript">
//			alert(localStorage.searchwhere+'localStorage.searchwhere')
            getinfor();
			$('.contentall').on('tap', '.home-dan', function() {
				//				alert(111);
				href('details.html', $(this).attr('id'));
			});

			function href(a, c) {
				localStorage.whereId = c;
				mui.openWindow({
					url: a,
					show: {
						aniShow: 'pop-in'
					}
				})
			}

			

			function getinfor() {
//            plus.nativeUI.showWaiting();	
				$.ajax({
						url: ur + '/mobile/product/searchShop',
						type: 'POST',
						headers: {
							"X-Token": localStorage.token,
						},
						dataType: 'json',
						data: {
							"parameter": localStorage.searchwhere,
						}
					})
					.done(function(data) {
//						plus.nativeUI.closeWaiting();
						console.log(JSON.stringify(data));
						//							console.log(data.result.data[0][1].plImgsrc);
						//							console.log(data.result.data[0].length)
						//						    console.log(data.result.data[1].length);
						//							var how = data.result.data[1].length;
						//                            
						//                            /*$('.img1').attr('scr',''+picur+data.result.data[0][1].plImgsrc+'');
						//                            $('.img2').attr('scr',''+picur+data.result.data[0][1].plImgsrc+'');
						//                            $('.img3').attr('scr',''+picur+data.result.data[0][2].plImgsrc+'');
						//                            $('.img4').attr('scr',''+picur+data.result.data[0][3].plImgsrc+'');
						//                            $('.img5').attr('scr',''+picur+data.result.data[0][3].plImgsrc+'');*/
						//                           
						//                           
						//                            var i = localStorage.lookwhere
						//                            console.log(picur+data.result.data[0][3].plImgsrc);
						//                            
						//                          
						//                          console.log(data.result.data[i][0].plName);
						//                          console.log(data.result.data[i].length);
						$('.title').text(localStorage.searchwhere);
						if(data.result.data.product.length == 0) {
							//                            	alert("小于0")
							var nodiv = ('<p style="text-align: center;margin-top: 25px;"><img src="img/nogood.png"/></p><p style="font-size: .8rem;heigth:2rem;margin: 1rem;text-align: center;">不好意思，没有查询到您要的商品...</p>');
							$('.home-se').append(nodiv);
						} else if(data.result.data.product.length >= 0) {

							for(var y = 0; y < data.result.data.product.length; y++) {
								var b = data.result.data.product[y].mainImg;
								console.log(b.indexOf(',') + '逗号索引值');
								var m = b.indexOf(',');
								if(m != '-1') {
									var mainImg = b.substring(0, m);
								} else {
									mainImg = b;
								}
								//                        	  		var inner = data.result.data[i];
								//                        	        console.log(data.result.data[i][y].plName+'====275');
								//                        	        console.log(data.result.data[2].length+'====276');
								var divdan = ('<div class="home-dan" id=' + data.result.data.product[y].id + '> ' +
									'<div class="home-picd" style="background:url(' + picur + mainImg + ')" ></div> ' +
									//									'<p>'+data.result.data.product.plRemark+'</p> '+
									'<p style="font-size: 1rem;heigth:2rem;">' + data.result.data.product[y].shortname + '</p>' +
									'<p style=" color: #e9af29;">¥<span style="font-size: 1rem;heigth:2rem;">' + data.result.data.product[y].price + '</span>' +
									//									'<span class="home-add"><img src="img/add.png" alt="" width="50%"/></span>' +
									'</p> ' +
									'</div>');
								$('.home-se').append(divdan);

							}
						}

					})
					

			}
		</script>
	</body>

</html>